package edu.njfu.homeork.utils

//package edu.njfu.networkdemo.utils
import retrofit2.Retrofit
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory
import retrofit2.converter.gson.GsonConverterFactory

object ServerCreator {
    //浩东服务器
//    private const val BASE_URL="http://121.4.31.15:8080/studentadminsystem/"
    //老师服务器
//    private const val BASE_URL="http://106.15.192.167:8080/"
    //电脑服务器tomcat
    private const val BASE_URL="http://182.61.52.25:8080/"

    private val retrofit=Retrofit.Builder()
        .baseUrl(BASE_URL)
        .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
        .addConverterFactory(GsonConverterFactory.create())
        .build()
    fun <T> create(serviceClass:Class<T>):T= retrofit.create(serviceClass)
    inline fun <reified  T> create():T=create(T::class.java)

}